package huffManCount;

public class Node<T> implements Comparable<Node<T>>{
    
    private T data;
    private int weigth;
    private Node<T> left;
    private Node<T> right;
    
    public Node(T data,int weigth){
        this.data=data;
        this.weigth=weigth;
    }
    public T getData() {
        return data;
    }
    public void setData(T data) {
        this.data = data;
    }
    public int getWeigth() {
        return weigth;
    }
    public void setWeigth(int weigth) {
        this.weigth = weigth;
    }
    public Node<T> getLeft() {
        return left;
    }
    public void setLeft(Node<T> left) {
        this.left = left;
    }
    public Node<T> getRight() {
        return right;
    }
    public void setRight(Node<T> right) {
        this.right = right;
    }
    @Override
    public String toString() {
        // TODO Auto-generated method stub
        return super.toString();
    }
    public int compareTo(Node<T> node) {
        // TODO Auto-generated method stub
        if(node.getWeigth()>this.getWeigth())
            return 1;
        if(node.getWeigth()<this.getWeigth())
            return -1;
        return 0;
    }    

}
